<?PHP 
//include("../config/connect.php");
//require_once("../public/common.php");
require_once("../public/biaoqing.php");

if (!isset($il_col)) $il_col = 4;
if (!isset($il_order)) $il_order = "t";
if (!isset($il_param)) $il_param = "";

// 搜索条件
if (!isset($il_userid)) $il_userid = "";
if (!isset($il_tag)) $il_tag = "";

$il_order = CheckUrlParamNoDie("il_order");
$nPage = CheckUrlParamNoDie("page"); //当前页数
if ($nPage == "") $nPage = 1;
//
$sql = "select num_iid, id, pic_url, url, item_title, time, fee, commission, favorite from cache_items where pic_url<>''";

if ($il_tag != "")
	$sql .= " and tag like '% $il_tag %'";

$sql .= " group by num_iid";

if ($il_order == "c"){
	$sql .= " order by commission desc";
}else{
	$sql .= " order by time desc";
}

$PAGE_SIZE = 100;
$limit = " limit ". ($nPage - 0)*$PAGE_SIZE .",$PAGE_SIZE";
$sql .= $limit;
//echo $sql;
//exit;
$result = mysql_query( $sql );
$i=0;
$nMaxCount = mysql_num_rows($result);
?>

<div>
	<!--div style=" padding:0;" class="container_12"></div-->
            <!-----推荐内容------->
            <div id="wall" class="itemDetail">
            <?PHP 
			for ($k = 0; $k < $il_col; ++$k) {
			?>
            	<div class="column grid_3 <?PHP if ($k == 0) echo "alpha"; else if ($k == $il_col-1) echo "omega";?>">
	                <?PHP 
						for( $i=$k; $i < $nMaxCount; $i += $il_col)
						{
					?>
               	  <div class="brand_new">
                   	<a target="_blank" href="../item/?t=kk&id=<?PHP echo mysql_result($result, $i, "id"); ?>" class="first" title="<?PHP echo mysql_result($result, $i, "item_title"); ?>">
           				<img width="180" src="<?PHP echo mysql_result($result, $i, "pic_url")."_250x250.jpg"; ?>
" alt="" title="" />
                		<p class="title"><?PHP echo mysql_result($result, $i, "item_title"); ?> </p>
                		<p class="price">购买时间：<span class="time"><?PHP echo mysql_result($result, $i, "time"); ?></span></p>
                		<p class="price qz-price">售价<em><?PHP echo mysql_result($result, $i, "fee"); ?></em><span <?php if(round(mysql_result($result, $i, "commission") * 0.6, 2) == "") echo 'style="display:none"'; ?> ><span class="coin">兔子省</span><span class="fan"><?PHP echo round(mysql_result($result, $i, "commission") * 0.6, 2); ?></span>元</span></p>
           			</a>                    
                  </div>
                    <?PHP 
					}
					?>
              </div>
              <?PHP } ?>
              
              
              <!----page--->
              <div style="" class="grid_12 alpha omega pager">
                	<div id="pageNav">                        
                        <?php	
						if ($nPage > 1) echo "<a class='pageNext' href='?page=".($nPage-1)."$il_param'>上一页&gt;</a>";
						
						for($i=1;$i<=13;$i++){//数字分页
							$Pageshow = ($i!=$nPage)?"<a href='?page=$i$il_param'>".($i)."</a>":"<b>".($i)."</b>";
							echo $Pageshow;
						  }
						  
						if ($nPage < 13) echo "<a class='pageNext' href='?page=".($nPage+1)."$il_param'>下一页&gt;</a>";						  
						 ?>
            		</div>
            	</div>
            </div>
</div>

<script language="javascript" src="../js/jquery.min.js"></script>
<script language="javascript">
function onfavorite(id)
{
	if (getCookie("item_favorite_"+id))
	{
		alert("您已经投过票了哦~~");
		return;
	}

	var url = "http://www.tusijie.com/item/item_static.php?opt=favorite&id=" + id;
	$.ajax({	url: url,
			async: true,
			success:function(res){
//			alert(res);
			document.getElementById("favorite").innerHTML=parseInt(document.getElementById("favorite").innerHTML)+1;
			setCookie("item_favorite_"+id,1, 2);
           }
		})
}
</script>